package com.mes.cloud.web;

import com.mes.cloud.api.dto.request.product.ProductCompetitiveBrandAddRequest;
import com.mes.cloud.api.dto.request.product.ProductCompetitiveBrandEnableRequest;
import com.mes.cloud.api.dto.request.product.ProductCompetitiveBrandPageRequest;
import com.mes.cloud.api.dto.response.product.ProductCompetitiveBrandPageDto;
import com.mes.cloud.common.CommPager;
import com.mes.cloud.common.JsonResult;
import com.mes.cloud.service.ProductCompetitiveBrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author xy
 * @version 2019-08-21 16:12:50
 * @email yuan.xue3@pactera.com
 */
@Api(tags = "对标竞品关联", value = "对标竞品关联接口")
@RestController
@RequestMapping(value = "/productCompetitiveBrand")
public class ProductCompetitiveBrandController  {

    private ProductCompetitiveBrandService productCompetitiveBrandService;

    @Autowired
    public ProductCompetitiveBrandController(ProductCompetitiveBrandService productCompetitiveBrandService) {
        this.productCompetitiveBrandService = productCompetitiveBrandService;
    }


    /**
     * <对标竞品关联新增>
     *
     * @param productCompetitiveBrandRequest
     * @return JsonResult
     * @author xy
     * @date 2019/8/28 14:51
     */
    @ApiOperation(value = "对标竞品关联新增", notes = "对标竞品关联新增")
    @PostMapping(value = "/add")
    public JsonResult add(@Valid @RequestBody ProductCompetitiveBrandAddRequest productCompetitiveBrandRequest) {
        return productCompetitiveBrandService.add(productCompetitiveBrandRequest);
    }

    /**
     * <产品禁用启用>
     *
     * @param updateEnableRequest
     * @return com.shinho.tntframe.core.common.model.JsonResult
     * @author xy
     * @date 2019/8/21 14:51
     */
    @ApiOperation(value = "产品禁用启用", notes = "产品禁用启用")
    @PostMapping(value = "/updateEnableFlag")
    public JsonResult updateEnableFlag(@Valid @RequestBody ProductCompetitiveBrandEnableRequest updateEnableRequest) {
        return productCompetitiveBrandService.updateEnableFlag(updateEnableRequest);
    }

    /**
     * <产品分页查询>
     *
     * @param productCompetitiveBrandPageRequest
     * @return JsonResult<CommPager<ProductCompetitiveBrandPageDto>>
     * @author xy
     * @date 2019/8/28 14:51
     */
    @ApiOperation(value = "产品分页查询", notes = "产品分页查询")
    @PostMapping(value = "/pageList")
    public JsonResult<CommPager<ProductCompetitiveBrandPageDto>> pageList(@Valid @RequestBody ProductCompetitiveBrandPageRequest productCompetitiveBrandPageRequest) {
        return productCompetitiveBrandService.pageList(productCompetitiveBrandPageRequest);
    }

}
